package com.jdllexample.jna;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;

/**
 * 参考：
 * http://blog.csdn.net/shendl/article/details/3589676
 * 官方地址：http://jna.java.net/
 * @author cklxh520@gmail.com
 *
 */
public class TestApi {
	public interface CLibrary extends Library {

		CLibrary INSTANCE = (CLibrary)
		Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"),CLibrary.class);
		void printf(String format, Object... args);
	}

	public static void main(String[] args) {
		CLibrary.INSTANCE.printf("Hello, World/n");
		for (int i = 0; i < args.length; i++) {
			CLibrary.INSTANCE.printf("Argument %d: %s/n", i, args[i]);
		}
	}
}
